package com.leoman.image.dao;

import com.leoman.image.entity.Expressions;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * Created by 涂奕恒 on 2014/12/4 16:16.
 */
public interface ExpressionDao extends JpaRepository<Expressions, Integer> {

    @Query("select a from Expressions a where a.parentId = ?1")
    public List<Expressions> findListByParentId(Long parentId);

    @Query("select a from Expressions a where a.parentId in (select b.welfare.id from UserWelfare b where b.userInfo.id = ?1) group by a.parentId")
    public List<Expressions> findList(Long userId);
}